package com.ebook.fsk;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import java.io.IOException;
import java.io.InputStream;

public class ReadtextActivity extends Activity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.readtxt);
  try {
//Return an AssetManager instance for your application's package
   InputStream is = getAssets().open("index.txt");
   int size = is.available();

   // Read the entire asset into a local byte buffer.
   byte[] buffer = new byte[size];
   is.read(buffer);
   is.close();

   // Convert the buffer into a string.
   String text = new String(buffer, "GB2312");

   // Finally stick the string into the text view.
   TextView tv = (TextView) findViewById(R.id.text);
   tv.setText(text);
  } catch (IOException e) {
   // Should never happen!
   throw new RuntimeException(e);
  }
 }
}
